# -*- coding: utf-8 -*-
"""
Created on Tue Dec  5 21:50:58 2017

@author: Administrator

获取A股所有股票行情历史:近1个月

"""
import tushare as ts

stock_info=ts.get_stock_basics(date=None)
def get_all_stock(dateStart=None,dateEnd=None):
    #获取所有股票代码
    for i in stock_info.index:
        print(i)    
        df=ts.get_hist_data(i,dateStart,dateEnd)
        szFile='./oc_data/'+i+'.csv'
        df.to_csv(szFile,columns=['open','high','low','close','volume'])
       
if __name__ == '__main__':
    get_all_stock('2017-11-05','2017-12-05')
    print('finish!')